package LoginPackage;

import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.testng.annotations.Test;
import org.junit.Assert;

import PagePackage.MyPageFactory;
import PagePackage.internalPageClass;
import PagePackage.leaguePage;
import PagePackage.loginPageClass;


public class NewLeagueClass extends TestBaseClass {
	boolean present;
	public Boolean Boolean;
	@Test (priority=0)	
	  public void SACreateLeaguesMaleBasketball() {
		  goToMainPage(); 
		  checkPage();
		  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@victoria.com", "webmaster");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
		  MyPageFactory.getPage(driver, leaguePage.class).clickAddNewLeagueButton()
		  .chooseLeagueSport("Basketball")
		  .addLeagueName("Selenium Male Basketball League")
		  .chooseGender("male")
		  .saveLeague()
		  .findLeague("Selenium Male Basketball League");
		  MyPageFactory.getPage(driver, leaguePage.class).scrollAndClickLeague( 0, 0, "//*[text()='Selenium Male Basketball League']");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
			 MyPageFactory.getPage(driver, internalPageClass.class).logout();
		  
		  
	} 
	
	
	@Test (priority=1)	
	  public void SACreatesLeagueFemaleBasketball() {
		  goToMainPage(); 
		  checkPage();
		  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@victoria.com", "webmaster");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
		  MyPageFactory.getPage(driver, leaguePage.class).clickAddNewLeagueButton()
		  .chooseLeagueSport("Basketball")
		  .addLeagueName("Selenium Female Basketball League")
		  .chooseGender("female")
		  .saveLeague()
		  .findLeague("Selenium Female Basketball League");
		  
		  MyPageFactory.getPage(driver, leaguePage.class).scrollAndClickLeague( 0, 0, "//*[text()='Selenium Female Basketball League']");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
			 MyPageFactory.getPage(driver, internalPageClass.class).logout();
		  
		  
	} 
		
	@Test (priority=2)	
	  public void SACreatesLeagueCoedBasketball() {
		  goToMainPage(); 
		  checkPage();
		  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@victoria.com", "webmaster");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
		  MyPageFactory.getPage(driver, leaguePage.class).clickAddNewLeagueButton()
		  .chooseLeagueSport("Basketball")
		  .addLeagueName("Selenium Coed Basketball League")
		  .chooseGender("coed")
		  .saveLeague()
		  .findLeague("Selenium Coed Basketball League");
		  MyPageFactory.getPage(driver, leaguePage.class).scrollAndClickLeague( 0, 0, "//*[text()='Selenium Coed Basketball League']");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
			 MyPageFactory.getPage(driver, internalPageClass.class).logout();
		  
		  
	} 
	
	@Test (priority=3)	
	
	  public void SACreatesLeagueMaleFootball() {
		  goToMainPage(); 
		  checkPage();
		  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@victoria.com", "webmaster");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
		  MyPageFactory.getPage(driver, leaguePage.class).clickAddNewLeagueButton()
		  .chooseLeagueSport("Football")
		  .addLeagueName("Selenium Male Football League")
		  .chooseGender("male")
		  .saveLeague()
		  .findLeague("Selenium Male Football League");
		  MyPageFactory.getPage(driver, leaguePage.class).scrollAndClickLeague( 0, 0, "//*[text()='Selenium Male Football League']");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
			 MyPageFactory.getPage(driver, internalPageClass.class).logout();
		  
		  
	}
	
	
	@Test (priority=4)	
	  public void SACreatesLeagueFemaleFootball() {
		  goToMainPage(); 
		  checkPage();
		  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@victoria.com", "webmaster");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
		  MyPageFactory.getPage(driver, leaguePage.class).clickAddNewLeagueButton()
		  .chooseLeagueSport("Football")
		  .addLeagueName("Selenium Female Football League")
		  .chooseGender("female")
		  .saveLeague()
		  .findLeague("Selenium Female Football League");
		  MyPageFactory.getPage(driver, leaguePage.class).scrollAndClickLeague( 0, 0, "//*[text()='Selenium Female Football League']");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
			 MyPageFactory.getPage(driver, internalPageClass.class).logout();
		  
		  
	}
	
	@Test (priority=5)	
	  public void SACreatesLeagueCoedFootball() {
		  goToMainPage(); 
		  checkPage();
		  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@victoria.com", "webmaster");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
		  MyPageFactory.getPage(driver, leaguePage.class).clickAddNewLeagueButton()
		  .chooseLeagueSport("Football")
		  .addLeagueName("Selenium Coed Football League")
		  .chooseGender("coed")
		  .saveLeague()
		  .findLeague("Selenium Coed Football League");
		  MyPageFactory.getPage(driver, leaguePage.class).scrollAndClickLeague( 0, 0, "//*[text()='Selenium Coed Football League']");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
			 MyPageFactory.getPage(driver, internalPageClass.class).logout();
		  
		  
	} 
	
	@Test (priority=6)	
	  public void SACreatesLeagueMaleLacrosse() {
		  goToMainPage(); 
		  checkPage();
		  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@victoria.com", "webmaster");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
		  MyPageFactory.getPage(driver, leaguePage.class).clickAddNewLeagueButton()
		  .chooseLeagueSport("Lacrosse")
		  .addLeagueName("Selenium Male Lacrosse League")
		  .chooseGender("male")
		  .saveLeague()
		  .findLeague("Selenium Male Lacrosse League");
		  MyPageFactory.getPage(driver, leaguePage.class).scrollAndClickLeague( 0, 0, "//*[text()='Selenium Male Lacrosse League']");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
			 MyPageFactory.getPage(driver, internalPageClass.class).logout();
		  
		  
	} 
	
	
	@Test (priority=7)	
	  public void SACreatesLeagueFemaleLacrosse() {
		  goToMainPage(); 
		  checkPage();
		  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@victoria.com", "webmaster");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
		  MyPageFactory.getPage(driver, leaguePage.class).clickAddNewLeagueButton()
		  .chooseLeagueSport("Lacrosse")
		  .addLeagueName("Selenium Female Lacrosse League")
		  .chooseGender("female")
		  .saveLeague()
		  .findLeague("Selenium Female Lacrosse League");
		  MyPageFactory.getPage(driver, leaguePage.class).scrollAndClickLeague( 0, 0, "//*[text()='Selenium Female Lacrosse League']");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
			 MyPageFactory.getPage(driver, internalPageClass.class).logout();
		 
		  
	} 
	
	@Test (priority=8)	
	  public void SACreatesLeagueCoedLacrosse() {
		  goToMainPage(); 
		  checkPage();
		  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@victoria.com", "webmaster");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
		  MyPageFactory.getPage(driver, leaguePage.class).clickAddNewLeagueButton()
		  .chooseLeagueSport("Lacrosse")
		  .addLeagueName("Selenium Coed Lacrosse League")
		  .chooseGender("coed")
		  .saveLeague()
		  .findLeague("Selenium Coed Lacrosse League");
		  MyPageFactory.getPage(driver, leaguePage.class).scrollAndClickLeague( 0, 0, "//*[text()='Selenium Coed Lacrosse League']");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
			 MyPageFactory.getPage(driver, internalPageClass.class).logout();
		  
		  
		  
	} 
	
	
	@Test (priority=9)	
	  public void SACancelsLeagueCreation() {
		  goToMainPage(); 
		  checkPage();
		  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@victoria.com", "webmaster");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
		  MyPageFactory.getPage(driver, leaguePage.class).clickAddNewLeagueButton()
		  .chooseLeagueSport("Lacrosse")
		  .addLeagueName("Selenium Cancel League")
		  .chooseGender("coed")
		  .cancelLeague()
		  .findLeague("Selenium Cancel League");
		 MyPageFactory.getPage(driver, leaguePage.class).scrollAndClickLeague2(0, 0, "//*[text()='Female Basketball League']");
		 driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
		 MyPageFactory.getPage(driver, internalPageClass.class).logout();
		 
	} 
	/*
	@Test (priority=10)	
	  public void AdminCannotCreateLeague() {
		  goToMainPage(); 
		 
		  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@krossover.com", "webmaster");
		  driver.get("https://www-dev.krossover.com/intelligence-qa/leagues");
		  
		  //MyPageFactory.getPage(driver, leaguePage.class).scrollAndClickLeague2(0, 0, "//*[text()='ADD NEW LEAGUE']");
		  
		  try {
			driver.findElement(By.className("btn-add-new2"));
		     present = true;
		  } catch (NoSuchElementException e) {
		     present = false;
		  }
		  assertEquals(false, present);
		  
	} */

	
	
	
}


